<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        img{
            display: block;
        }
    </style>
</head>
<body>
<img onmouseenter="show()" onmouseleave="hid()" src="pre4.jpg" width="120px" height="200px">
<img src="pre4.jpg">
<script>

    let img2 = document.getElementsByTagName('img')[1];
    img2.style.display = 'none';
    function show() {
        img2.style.display = 'block';
        // confirm('你确定要离开吗')
        // alert('你确定要离开吗')
    }

    function hid() {
        img2.style.display = 'none';
    }

</script>
</body>
</html>